package com.dy.course.enumerate;

public enum RoomType {

	CLASSROOM(1, "教室"), MEETINGROOM(2, "会议室");

	private Integer code;
	private String desc;

	private RoomType(Integer code, String desc) {
		this.code = code;
		this.desc = desc;
	}

	public Integer getCode() {
		return this.code;
	}

	public String getDesc() {
		return this.desc;
	}

	public static String getDesc(Integer code) {
		RoomType[] mses = RoomType.values();
		for (RoomType ms : mses) {
			if (ms.getCode() == code) {
				return ms.getDesc();
			}
		}
		return null;
	}

	public static boolean isCorrent(Integer code) {
		String desc = getDesc(code);
		return desc != null;
	}
}
